package pl.edu.mimuw.irs.core.model.design;

import java.util.LinkedList;
import java.util.List;

import pl.edu.mimuw.irs.core.model.design.processing.Requirement;
import pl.edu.mimuw.irs.core.model.design.processing.Role;
import pl.edu.mimuw.irs.core.model.design.processing.RoleInstance;
import pl.edu.mimuw.irs.core.util.Position;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-07
 */
public class IRSActivity extends IRSTransition {
	
	// *** Attributes
	
	private List<Requirement> requirements;
	public List<Requirement> getRequirements() {
		if (requirements == null) requirements = new LinkedList<Requirement>();
		return requirements;
	}
	public void setRequirements(List<Requirement> requirements) {
		this.requirements = requirements;
	}
	
	// *** Constructors

	public IRSActivity(String newId, NodeType nodeType, Position position) {
		super(newId, nodeType, position);
		createSampleRequirements();
	}
	
	public IRSActivity(String id, Position position) {
		super(id, position);
		createSampleRequirements();
	}

	public IRSActivity(Position position) {
		super(position);
		createSampleRequirements();
	}
	
	// *** Methods
	
	private void createSampleRequirements() {
		// TODO Delete!
		Requirement requirementA = new Requirement();
		Requirement requirementAB = new Requirement();
		Requirement requirementC = new Requirement();
		
		requirementA.addRoleInstance(new RoleInstance(new Role("A"), 1));
		requirementAB.addRoleInstance(new RoleInstance(new Role("A"), 1));
		requirementAB.addRoleInstance(new RoleInstance(new Role("B"), 1));
		requirementC.addRoleInstance(new RoleInstance(new Role("C"), 1));
		
		getRequirements().add(requirementA);
		getRequirements().add(requirementAB);
		getRequirements().add(requirementC);
	}
}
